package com.firestone.dao.primary.center;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.firestone.bean.dto.resource.ResourceListDTO;
import com.firestone.bean.entity.mysql.primary.ImCenterResource;

/**
 * <p>
 * 系统资源库表 Mapper 接口
 * </p>
 *
 * @author CAIYJ
 * @since 2018-03-27
 */
public interface ImCenterResourceDao extends BaseMapper<ImCenterResource> {

    /**
     * @Description: TODO(资源列表)
     * @return
     * @author CAIYJ
     * @param <T>
     * @date 2018年3月29日 上午10:20:06
     * @lastModifier CAIYJ
     */
    @Select("<script>  "
            + "SELECT cr.id, cr.`name`, cr.type, cr.url, cr.`describe`, "
            + "cr.is_delete, cr.create_time, cr.update_time, "
            + "cm.real_name as create_user, cm1.real_name AS update_user "
            + "FROM im_center_resource AS cr "
            + "LEFT JOIN im_center_manager AS cm ON cm.id = cr.creator "
            + "LEFT JOIN im_center_manager AS cm1 ON cm1.id = cr.reviser "
            + "<where>" + "${ew.sqlSegment}" + "</where>" + "</script> ")
    <T> List<ResourceListDTO> selectResourceList(Pagination pagination,
            @Param("ew") Wrapper<T> wrapper);
}
